﻿/*
 * @Author: Dreamy Icecream 
 * @Date: 2020-12-30 17:11:27 
 * @Description: 屏幕后处理效果基类
 * @Last Modified by: Dreamy Icecream
 * @Last Modified time: 2020-12-30 19:11:01
 */

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[ExecuteInEditMode]
[RequireComponent (typeof (Camera))]
public class PostEffectsBase : MonoBehaviour {

    protected Material CheckShaderAndCreateMaterial (Shader shader, Material material) {
        if (shader == null) {
            return null;
        }

        if (shader.isSupported && material && material.shader == shader) {
            return material;
        }

        if (!shader.isSupported) {
            return null;

        } else {
            material = new Material (shader);
            material.hideFlags = HideFlags.DontSave;
            if (material) {
                return material;
            } else {
                return null;
            }
        }
    }

}